home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fSort
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "Sort Records"
- ClientHeight = 2370
- ClientLeft = 3090
- ClientTop = 3120
- ClientWidth = 5070
- ControlBox = 0 'False
- Height = 2835
- Left = 3000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2412
- ScaleMode = 0 'User
- ScaleWidth = 5160
- Top = 2745
- Width = 5250
- Begin ListBox cFieldList
- BackColor = &H00FFFFFF&
- Height = 1395
- Left = 240
- TabIndex = 1
- Tag = " OL"
- Top = 360
- Width = 1695
- End
- Begin CommandButton OkayButton
- Caption = "&OK"
- Default = -1 'True
- Enabled = 0 'False
- Height = 372
- Left = 2340
- TabIndex = 3
- Top = 420
- Width = 1691
- End
- Begin CommandButton CancelButton
- Cancel = -1 'True
- Caption = "&Cancel"
- Height = 372
- Left = 2340
- TabIndex = 0
- Top = 1320
- Width = 1691
- End
- Begin Label FieldListLabel
- BackColor = &H00C0C0C0&
- Caption = "Fields:"
- Height = 192
- Left = 240
- TabIndex = 2
- Top = 120
- Width = 1092
- End
- Option Explicit
- Dim FNotFound As Integer
- Sub CancelButton_Click ()
- Hide
- 'set the flag for the dynaset/dynagrid form
- gfFindFailed = True
- End Sub
- Sub cFieldList_Click ()
- If cFieldList <> "" Then
- OkayButton.Enabled = True
- Else
- OkayButton.Enabled = False
- End If
- End Sub
- Sub Form_Load ()
- Me.Left = (screen.Width - Me.Width) / 2
- Me.Top = (screen.Height - Me.Height) / 2
- End Sub
- Sub Form_Paint ()
- Outlines Me
- End Sub
- Sub OkayButton_Click ()
- Dim i As Integer
- Dim k As Integer
- Dim stripedSort As String
- On Error GoTo FindErr
- FNotFound = False
- SetHourGlass Me
- gSortStr = cFieldList
- stripedSort = gSortStr ' needed for compare later
- gSortStr = "[" + gSortStr + "]"
-
- ' see if this was not a stored query..if not add to SQL statement for save
- If Not gStoredFlag Then
- i = InStr(1, UCase(gstDynaString), "ORDER BY") 'see if a where exists
- If i = 0 Then
- gstDynaString = Trim(gstDynaString) & " Order By " & gTblname & "." & gSortStr
- Else
- k = InStr(i + 8, UCase(gstDynaString), UCase(stripedSort))' is this sort already used?
- If k = 0 Then
- gstDynaString = Trim(gstDynaString) & "," & gTblname & "." & gSortStr
- End If
- End If
- End If
- Hide
- GoTo FindEnd
- FindErr:
- If Err <> EOF_ERR Then
- ShowError
- Resume FindEnd
- Else
- FNotFound = True
- Resume Next
- End If
- FindEnd:
- ResetMouse Me
- End Sub
-